package Algorithm.BinaryResearch;

public class 找到最大的比target小的值 {
    public int q(int[] nums, int t) {
        int l = 0, r = nums.length - 1;
        // 找到满足 times[l] <= t 的最大的 l
        while (l < r) {
            int m = l + (r - l + 1) / 2;
            if (nums[m] <= t) {
                l = m;
            } else {
                r = m - 1;
            }
        }
        return l;
    }
}
